#
# Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
#
#   GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
#   Author :  Shawn.Tan
#   Date : 2025.10.28
#
#   History : Initial Version 2025.10.28
#
#
# classes, code related to Branch not taken.

from base.Sequence import Sequence

# -------------------------------------------------------------------------------------------------------
# BntSequence to provide base class for bnt squence
# -------------------------------------------------------------------------------------------------------


class BntSequence(Sequence):
    def __init__(self, gen_thread, instr_num=10):
        super().__init__(gen_thread)
        self.instr_num = instr_num
        self.bntCallback = None

    def setup(self, **kargs):
        super().setup(**kargs)
        self.genThread.modifyGenMode("Filler")

    def generate(self, **kargs):
        if self.bntCallback:
            self.bntCallback()

    def getInstrNum(self):
        return self.instr_num

    def setInstrNum(self, instr_num):
        self.instr_num = instr_num

    def setBntCallback(self, callback):
        self.bntCallback = callback

    def cleanUp(self, **kargs):
        super().cleanUp(**kargs)
        self.genThread.revertGenMode("Filler")
